Class IEmitter

java.lang.Object
particleengine.IEmitter
Direct Known Subclasses:
BaseIEmitter, Emitter

public abstract class IEmitter extends Object
Emitter interface. Extend to make custom particle emitters.
  • Constructor Details

    • IEmitter

      public IEmitter()
  • Method Details

    • getLocation

      public abstract org.lwjgl.util.vector.Vector2f getLocation()
      Returns:
      Absolute location of this emitter, in world coordinates.
    • getSprite

      public abstract com.fs.starfarer.api.graphics.SpriteAPI getSprite()
      Returns:
      Sprite that particles from this emitter will have. Can be null, in which a default particle will be used.
    • getXDir

      public abstract float getXDir()
      Returns:
      Angle, in degrees, that this emitter's x-axis faces. If 0, then this emitter's axes coincides with global axes (x-axis facing to the right).
    • getBlendSourceFactor

      public abstract int getBlendSourceFactor()
      Returns:
      Source blend factor, e.g. GL11.GL_SRC_ALPHA.
    • getBlendDestinationFactor

      public abstract int getBlendDestinationFactor()
      Returns:
      Destination blend factor, e.g. GL11.GL_ONE_MINUS_SRC_ALPHA.
    • getBlendFunc

      public abstract int getBlendFunc()
      Returns:
      Blending operation, e.g. GL14.GL_FUNC_ADD.
    • getLayer

      public abstract com.fs.starfarer.api.combat.CombatEngineLayers getLayer()
      Returns:
      Combat layer particles should be rendered on.
    • getCampaignLayer

      public abstract com.fs.starfarer.api.campaign.CampaignEngineLayers getCampaignLayer()
      Returns:
      Campaign layer particles should be rendered on.
    • isAlwaysRenderInCampaign

      public abstract boolean isAlwaysRenderInCampaign()
      Returns:
      Whether the particles should persist through campaign location transitions. Note that particle and emitter positions are world-space-relative, not screen-space-relative, so dynamic anchoring and changing emitters' positions in a CurrentLocationChangedListener is required to fix particles' screen-space positions.
    • getRenderRadius

      public abstract float getRenderRadius()
      Returns:
      Distance from edge of screen beyond which particles are culled before generation. This applies to the emitter's location rather than individual particles' locations.
    • enableDynamicAnchoring

      public final void enableDynamicAnchoring()
      Sets a flag that will allow particles generated by this emitter to dynamically follow its motion.
    • disableDynamicAnchoring

      public final void disableDynamicAnchoring()
      Unsets the flag that allows particles generated by this emitter to dynamically follow its motion.
    • isDynamicAnchoring

      public final boolean isDynamicAnchoring()
      Returns:
      Whether dynamic anchoring of particles is enabled
    • setSmoothDynamic

      public final void setSmoothDynamic(boolean isSmoothDynamic)
      Parameters:
      isSmoothDynamic - If enabled, particles will begin at their non-dynamic starting points and will end at their dynamic ending points.
      Can be used to, for example, create an absorption effect where particles are absorbed by their dynamically tracked entity.
    • isSmoothDynamic

      public final boolean isSmoothDynamic()
      Returns:
      Whether particles should begin at their non-dynamic starting points and end at their dynamic ending points
    • burst

      public final boolean burst(int count)
      Generates an instantaneous burst of particles.
      Parameters:
      count - Number of particles to generate.
      Returns:
      Whether the particles were successfully generated.
    • stream

      public final void stream(int particlesPerBurst, float particlesPerSecond, float duration)
      Generates a continuous stream of particles.
      Parameters:
      particlesPerBurst - Number of particles that should be generated at once.
      particlesPerSecond - Total number of particles generated per second.
      duration - Amount of time this particle stream should last. If negative, the stream will never expire.
    • stream

      public final <T extends IEmitter> void stream(int particlesPerBurst, float particlesPerSecond, float maxDuration, @Nullable Particles.StreamAction<T> doBeforeGenerating)
      Generates a continuous stream of particles.
      Parameters:
      particlesPerBurst - Number of particles that should be generated at once.
      particlesPerSecond - Total number of particles generated per second.
      maxDuration - Maximum amount of time this particle stream should last. If negative, the stream will not naturally expire.
      doBeforeGenerating - Custom function that's called immediately before each particle generation sequence in this stream. Returning false will end the stream.
    • stream

      public final <T extends IEmitter> void stream(int particlesPerBurst, float particlesPerSecond, float maxDuration, @Nullable Particles.StreamAction<T> doBeforeGenerating, @Nullable Particles.StreamAction<T> doWhenFinished)
      Generates a continuous stream of particles.
      Parameters:
      particlesPerBurst - Number of particles that should be generated at once.
      particlesPerSecond - Total number of particles generated per second.
      maxDuration - Maximum amount of time this particle stream should last. If negative, the stream will not naturally expire.
      doBeforeGenerating - Custom function that's called immediately before each particle generation sequence in this stream. Returning false will end the stream.
      doWhenFinished - Custom function that's called when the stream expires, which can occur either naturally, if doBeforeGenerating returns false, or if the stream's emitter's anchor point is removed from play. The return value is not used.